package edu.umd.ion.wavemeter.server;

import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import edu.umd.ion.wavemeter.service.DynamicExposureParameters;


@SuppressWarnings("serial")
@Entity(name="DynamicExposureParameters")
@Table(name="DynamicExposureParameters")
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
@NamedQueries({
    @NamedQuery(name="AllDynamicExposureParams",
        query="SELECT x FROM DynamicExposureParameters x")
})
public class PersistentDynamicExposureParameters extends PersistentExposureParameters 
	implements PersistentObject<Integer, PersistentDynamicExposureParameters> {
	private int MaxPossible = 4095;
	private int MaxAdj = 3500;
	private int Optimum = 2500;
	private int MinAdj = 2500;
	private int ReduceToPercent = 40;
	private int MaxExposure = 100;
	private int MinExposure = 1;
	private double SecondInterferometerBalance = 2.0;
	private int SkipCount = 0;
	
	public PersistentDynamicExposureParameters() {
		id = 1;
	}
	
	public DynamicExposureParameters plain() {
		DynamicExposureParameters p = new DynamicExposureParameters();
		p.MaxPossible = MaxPossible;
		p.MaxAdj = MaxAdj;
		p.Optimum = Optimum;
		p.MinAdj = MinAdj;
		p.ReduceToPercent = ReduceToPercent;
		p.MaxExposure = MaxExposure;
		p.MinExposure = MinExposure;		
		p.UnderexposedTimeout = UnderexposedTimeout;
		p.SecondInterferometerBalance = SecondInterferometerBalance;
		p.SkipCount = SkipCount;
		return p;
	}
	
	public void set(DynamicExposureParameters p) {
		MaxPossible = p.MaxPossible;
		MaxAdj = p.MaxAdj;
		Optimum = p.Optimum;
		MinAdj = p.MinAdj;
		ReduceToPercent = p.ReduceToPercent;
		MaxExposure = p.MaxExposure;
		MinExposure = p.MinExposure;
		UnderexposedTimeout = p.UnderexposedTimeout;
		SecondInterferometerBalance = p.SecondInterferometerBalance;
		SkipCount = p.SkipCount;
	}
	
	public void set(PersistentDynamicExposureParameters p) {
		super.set(p);
		MaxPossible = p.MaxPossible;
		MaxAdj = p.MaxAdj;
		Optimum = p.Optimum;
		MinAdj = p.MinAdj;
		ReduceToPercent = p.ReduceToPercent;
		MaxExposure = p.MaxExposure;
		MinExposure = p.MinExposure;
		UnderexposedTimeout = p.UnderexposedTimeout;
		SecondInterferometerBalance = p.SecondInterferometerBalance;
		SkipCount = p.SkipCount;
	}
}
